package com.zhiyu.util;

import java.util.HashMap;
import java.util.Map;

public class MapBuilder {

    Map<String, Object> map = new HashMap<String, Object>();

    public MapBuilder() {
    }

    /**
     *   添加键值对，返回this为链式添加服务
     *   @return 本对象
     */
    public MapBuilder put(String key, Object value) {
        map.put(key, value);
        return this;
    }

    /**
     *   获取最终的map对象
     *   @return map对象
     */
    public Map build() {
        return map;
    }

    /**
     *   获取MapBuilder实例
     *   @return MapBuilder对象
     */
    public static MapBuilder newInstance() {
        return new MapBuilder();
    }
}
